// Test model 文章表

var mongoose = require('mongoose'),
  Schema = mongoose.Schema;

var TestSchema = new Schema({
    title: { type: String, require: true },
    content: { type: String, require: true },
    slug: { type: String, require: true },
    category: { type: Schema.Types.ObjectId, ref: 'Category' },
    author: { type: Schema.Types.ObjectId, ref: 'User' },
    published: { type: Boolean, default: false },
    meta: { type: Boolean, default: false },
    meta: { type: Schema.Types.Mixed },
    comments: [ Schema.Types.Mixed ],
    created: { type: Date },
    nickname: {
      type: String,
      default: '柯文'
    },
    regTime: {
      type: Date,
      default: Date.now
    },
    blog: {
      type: String,
      get: function(url){
        return url;
      }
    }
});

mongoose.model('Test', TestSchema);

